package com.ruibang.glass.quality.controller;

import com.ruibang.glass.quality.component.job.DataDispose;
import com.ruibang.glass.quality.domain.req.DefectHourTaskReq;
import com.ruibang.glass.quality.service.TotalEquDataService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-04-03  10:51
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/judgment/defect")
@Api(value = "判废缺陷控制器", tags = {"判废缺陷控制器"})
public class TotalEquDataController {

    @Autowired
    private DataDispose dataDispose;

    @Autowired
    private TotalEquDataService totalEquDataService;

    @PostMapping("/defectHourTask")
    @ApiOperation(value = "缺陷小时任务", notes = "缺陷小时任务")
    public ResultBody defectHourTask(@RequestBody DefectHourTaskReq defectHourTaskReq) {
        dataDispose.hourTask(defectHourTaskReq);
        return ResultBody.success();
    }

    @PostMapping("/getHotData")
    @ApiOperation(value = "热端缺陷小时任务", notes = "热端缺陷小时任务")
    public ResultBody getHotData(@RequestBody DefectHourTaskReq defectHourTaskReq) {
        totalEquDataService.importHotEndDiscardDefectData(defectHourTaskReq);
        return ResultBody.success();
    }
}
